----------------------------------------------------------------------------
-- 1. This file automatically generates code for the LuatOS's UI designer
-- 2. In case of accident, modification is strictly prohibited
----------------------------------------------------------------------------

--Import event file
require "UiHandle"

local function objectHide()
	local o = {}
	local tSelf = {}
	setmetatable(o, tSelf)
	tSelf.__index = tSelf
	tSelf.__tostring = function(j)
		return j.self
	end
	tSelf.__tocall = function(j)
		return j.cb
	end
	tSelf.self = nil
	tSelf.cb = function(e) end
	return o
end

P1 = 
{
	create = nil, 
	free = nil,
	contFather_P1 = nil,
	LvglImg1 = objectHide(),
	LvglButton7 = objectHide(),
}
game = 
{
	create = nil, 
	free = nil,
	contFather_game = nil,
	LvglImg3 = objectHide(),
	LvglButton3 = objectHide(),
	LvglButton4 = objectHide(),
	LvglButton5 = objectHide(),
	LvglButton6 = objectHide(),
	LvglLabel2 = objectHide(),
	LvglImghead = objectHide(),
	LvglImgmnck = objectHide(),
	LvglLabelscore = objectHide(),
}
gmover = 
{
	create = nil, 
	free = nil,
	contFather_gmover = nil,
	LvglImg2 = objectHide(),
	LvglLabel1 = objectHide(),
	LvglButton1 = objectHide(),
}
----------------------------------------------------------------------------
--The following is the content of screen: P1
---------------------------------------------------------------------------
P1.create = function()
	P1.contFather_P1 = lvgl.cont_create(lvgl.scr_act(), nil)
	lvgl.obj_set_size(P1.contFather_P1, 480, 854)
	lvgl.obj_align(P1.contFather_P1, nil, lvgl.ALIGN_IN_TOP_LEFT, 0, 0)

	--This is the IMG_PART_MAIN's style of P1.LvglImg1
	Style_LvglImg1_1=lvgl.style_t()
	lvgl.style_init(Style_LvglImg1_1)

	--This is the base code of P1.LvglImg1
	P1.LvglImg1.self = lvgl.img_create(P1.contFather_P1, nil)
	lvgl.obj_set_click(P1.LvglImg1.self, true)
	lvgl.img_set_src(P1.LvglImg1.self, "/lua/bg.png")
	lvgl.obj_align(P1.LvglImg1.self, P1.contFather_P1, lvgl.ALIGN_IN_TOP_LEFT, 0, 0)
	lvgl.obj_add_style(P1.LvglImg1.self, lvgl.IMG_PART_MAIN, Style_LvglImg1_1)


	--This is the BTN_PART_MAIN's style of P1.LvglButton7
	Style_LvglButton7_1=lvgl.style_t()
	lvgl.style_init(Style_LvglButton7_1)
	lvgl.style_set_radius(Style_LvglButton7_1, lvgl.STATE_DEFAULT, 85)
	lvgl.style_set_bg_color(Style_LvglButton7_1, lvgl.STATE_DEFAULT, lvgl.color_hex(0x0088FF))
	lvgl.style_set_text_color(Style_LvglButton7_1, lvgl.STATE_DEFAULT, lvgl.color_hex(0xFFFFFF))

	--This is the base code of P1.LvglButton7
	P1.LvglButton7.self = lvgl.btn_create(P1.contFather_P1, nil)
	lvgl.obj_set_size(P1.LvglButton7.self, 150, 150)
	lvgl.obj_set_click(P1.LvglButton7.self, true)
	--This is the virtual Label of LvglButton7
	vLabel_LvglButton7 = lvgl.label_create(P1.LvglButton7.self, nil)
	lvgl.label_set_text(vLabel_LvglButton7, "开始游戏")
	lvgl.obj_add_style(vLabel_LvglButton7, lvgl.LABEL_PART_MAIN, Style_LvglButton7_1)
	lvgl.obj_align(P1.LvglButton7.self, P1.contFather_P1, lvgl.ALIGN_IN_TOP_LEFT, 156, 266)
	lvgl.obj_add_style(P1.LvglButton7.self, lvgl.BTN_PART_MAIN, Style_LvglButton7_1)
	--This is to add callback function for P1.LvglButton7
	--This is callBack function of P1.LvglButton7
	local handleLvglButton7 = function(obj, e)
		P1.LvglButton7.cb(e)
		P1.LvglButton7.cb = function(e)
			if (e == lvgl.EVENT_CLICKED)then
				startgame()
			end
		end
	end
	lvgl.obj_set_event_cb(P1.LvglButton7.self, handleLvglButton7)
end
P1.free = function()
	lvgl.obj_del(P1.contFather_P1)
	P1.contFather_P1 = nil
end

----------------------------------------------------------------------------
--The following is the content of screen: game
---------------------------------------------------------------------------
game.create = function()
	game.contFather_game = lvgl.cont_create(lvgl.scr_act(), nil)
	lvgl.obj_set_size(game.contFather_game, 480, 854)
	lvgl.obj_align(game.contFather_game, nil, lvgl.ALIGN_IN_TOP_LEFT, 0, 0)

	--This is the IMG_PART_MAIN's style of game.LvglImg3
	Style_LvglImg3_1=lvgl.style_t()
	lvgl.style_init(Style_LvglImg3_1)

	--This is the base code of game.LvglImg3
	game.LvglImg3.self = lvgl.img_create(game.contFather_game, nil)
	lvgl.obj_set_click(game.LvglImg3.self, true)
	lvgl.img_set_src(game.LvglImg3.self, "/lua/bg2.png")
	lvgl.obj_align(game.LvglImg3.self, game.contFather_game, lvgl.ALIGN_IN_TOP_LEFT, 0, 0)
	lvgl.obj_add_style(game.LvglImg3.self, lvgl.IMG_PART_MAIN, Style_LvglImg3_1)


	--This is the BTN_PART_MAIN's style of game.LvglButton3
	Style_LvglButton3_1=lvgl.style_t()
	lvgl.style_init(Style_LvglButton3_1)
	lvgl.style_set_radius(Style_LvglButton3_1, lvgl.STATE_DEFAULT, 30)
	lvgl.style_set_bg_color(Style_LvglButton3_1, lvgl.STATE_DEFAULT, lvgl.color_hex(0xFFFFFF))
	lvgl.style_set_value_str(Style_LvglButton3_1, lvgl.STATE_DEFAULT, "左")
	lvgl.style_set_value_color(Style_LvglButton3_1, lvgl.STATE_DEFAULT, lvgl.color_hex(0x1A1A1A))
	lvgl.style_set_border_color(Style_LvglButton3_1, lvgl.STATE_DEFAULT, lvgl.color_hex(0x0000FF))
	lvgl.style_set_border_side(Style_LvglButton3_1, lvgl.STATE_DEFAULT, lvgl.BORDER_SIDE_FULL)

	--This is the base code of game.LvglButton3
	game.LvglButton3.self = lvgl.btn_create(game.contFather_game, nil)
	lvgl.obj_set_size(game.LvglButton3.self, 58, 60)
	lvgl.obj_set_click(game.LvglButton3.self, true)
	--This is the virtual Label of LvglButton3
	vLabel_LvglButton3 = lvgl.label_create(game.LvglButton3.self, nil)
	lvgl.label_set_text(vLabel_LvglButton3, "左")
	lvgl.obj_add_style(vLabel_LvglButton3, lvgl.LABEL_PART_MAIN, Style_LvglButton3_1)
	lvgl.obj_align(game.LvglButton3.self, game.contFather_game, lvgl.ALIGN_IN_TOP_LEFT, 83, 690)
	lvgl.obj_add_style(game.LvglButton3.self, lvgl.BTN_PART_MAIN, Style_LvglButton3_1)
	--This is to add callback function for game.LvglButton3
	--This is callBack function of game.LvglButton3
	local handleLvglButton3 = function(obj, e)
		game.LvglButton3.cb(e)
		game.LvglButton3.cb = function(e)
			if (e == lvgl.EVENT_CLICKED)then
				dir_left()
			end
		end
	end
	lvgl.obj_set_event_cb(game.LvglButton3.self, handleLvglButton3)


	--This is the BTN_PART_MAIN's style of game.LvglButton4
	Style_LvglButton4_1=lvgl.style_t()
	lvgl.style_init(Style_LvglButton4_1)
	lvgl.style_set_radius(Style_LvglButton4_1, lvgl.STATE_DEFAULT, 30)
	lvgl.style_set_bg_color(Style_LvglButton4_1, lvgl.STATE_DEFAULT, lvgl.color_hex(0xFFFFFF))
	lvgl.style_set_value_str(Style_LvglButton4_1, lvgl.STATE_DEFAULT, "右")
	lvgl.style_set_value_color(Style_LvglButton4_1, lvgl.STATE_DEFAULT, lvgl.color_hex(0x1A1A1A))
	lvgl.style_set_border_color(Style_LvglButton4_1, lvgl.STATE_DEFAULT, lvgl.color_hex(0x0000FF))
	lvgl.style_set_border_side(Style_LvglButton4_1, lvgl.STATE_DEFAULT, lvgl.BORDER_SIDE_FULL)

	--This is the base code of game.LvglButton4
	game.LvglButton4.self = lvgl.btn_create(game.contFather_game, nil)
	lvgl.obj_set_size(game.LvglButton4.self, 58, 60)
	lvgl.obj_set_click(game.LvglButton4.self, true)
	--This is the virtual Label of LvglButton4
	vLabel_LvglButton4 = lvgl.label_create(game.LvglButton4.self, nil)
	lvgl.label_set_text(vLabel_LvglButton4, "右")
	lvgl.obj_add_style(vLabel_LvglButton4, lvgl.LABEL_PART_MAIN, Style_LvglButton4_1)
	lvgl.obj_align(game.LvglButton4.self, game.contFather_game, lvgl.ALIGN_IN_TOP_LEFT, 288, 689)
	lvgl.obj_add_style(game.LvglButton4.self, lvgl.BTN_PART_MAIN, Style_LvglButton4_1)
	--This is to add callback function for game.LvglButton4
	--This is callBack function of game.LvglButton4
	local handleLvglButton4 = function(obj, e)
		game.LvglButton4.cb(e)
		game.LvglButton4.cb = function(e)
			if (e == lvgl.EVENT_CLICKED)then
				dir_right()
			end
		end
	end
	lvgl.obj_set_event_cb(game.LvglButton4.self, handleLvglButton4)


	--This is the BTN_PART_MAIN's style of game.LvglButton5
	Style_LvglButton5_1=lvgl.style_t()
	lvgl.style_init(Style_LvglButton5_1)
	lvgl.style_set_radius(Style_LvglButton5_1, lvgl.STATE_DEFAULT, 30)
	lvgl.style_set_bg_color(Style_LvglButton5_1, lvgl.STATE_DEFAULT, lvgl.color_hex(0xFFFFFF))
	lvgl.style_set_value_str(Style_LvglButton5_1, lvgl.STATE_DEFAULT, "上")
	lvgl.style_set_value_color(Style_LvglButton5_1, lvgl.STATE_DEFAULT, lvgl.color_hex(0x1A1A1A))
	lvgl.style_set_border_color(Style_LvglButton5_1, lvgl.STATE_DEFAULT, lvgl.color_hex(0x0000FF))
	lvgl.style_set_border_side(Style_LvglButton5_1, lvgl.STATE_DEFAULT, lvgl.BORDER_SIDE_FULL)

	--This is the base code of game.LvglButton5
	game.LvglButton5.self = lvgl.btn_create(game.contFather_game, nil)
	lvgl.obj_set_size(game.LvglButton5.self, 58, 60)
	lvgl.obj_set_click(game.LvglButton5.self, true)
	--This is the virtual Label of LvglButton5
	vLabel_LvglButton5 = lvgl.label_create(game.LvglButton5.self, nil)
	lvgl.label_set_text(vLabel_LvglButton5, "上")
	lvgl.obj_add_style(vLabel_LvglButton5, lvgl.LABEL_PART_MAIN, Style_LvglButton5_1)
	lvgl.obj_align(game.LvglButton5.self, game.contFather_game, lvgl.ALIGN_IN_TOP_LEFT, 182, 629)
	lvgl.obj_add_style(game.LvglButton5.self, lvgl.BTN_PART_MAIN, Style_LvglButton5_1)
	--This is to add callback function for game.LvglButton5
	--This is callBack function of game.LvglButton5
	local handleLvglButton5 = function(obj, e)
		game.LvglButton5.cb(e)
		game.LvglButton5.cb = function(e)
			if (e == lvgl.EVENT_CLICKED)then
				dir_up()
			end
		end
	end
	lvgl.obj_set_event_cb(game.LvglButton5.self, handleLvglButton5)


	--This is the BTN_PART_MAIN's style of game.LvglButton6
	Style_LvglButton6_1=lvgl.style_t()
	lvgl.style_init(Style_LvglButton6_1)
	lvgl.style_set_radius(Style_LvglButton6_1, lvgl.STATE_DEFAULT, 30)
	lvgl.style_set_bg_color(Style_LvglButton6_1, lvgl.STATE_DEFAULT, lvgl.color_hex(0xFFFFFF))
	lvgl.style_set_value_str(Style_LvglButton6_1, lvgl.STATE_DEFAULT, "下")
	lvgl.style_set_value_color(Style_LvglButton6_1, lvgl.STATE_DEFAULT, lvgl.color_hex(0x1A1A1A))
	lvgl.style_set_border_color(Style_LvglButton6_1, lvgl.STATE_DEFAULT, lvgl.color_hex(0x0000FF))
	lvgl.style_set_border_side(Style_LvglButton6_1, lvgl.STATE_DEFAULT, lvgl.BORDER_SIDE_FULL)

	--This is the base code of game.LvglButton6
	game.LvglButton6.self = lvgl.btn_create(game.contFather_game, nil)
	lvgl.obj_set_size(game.LvglButton6.self, 58, 60)
	lvgl.obj_set_click(game.LvglButton6.self, true)
	--This is the virtual Label of LvglButton6
	vLabel_LvglButton6 = lvgl.label_create(game.LvglButton6.self, nil)
	lvgl.label_set_text(vLabel_LvglButton6, "下")
	lvgl.obj_add_style(vLabel_LvglButton6, lvgl.LABEL_PART_MAIN, Style_LvglButton6_1)
	lvgl.obj_align(game.LvglButton6.self, game.contFather_game, lvgl.ALIGN_IN_TOP_LEFT, 183, 744)
	lvgl.obj_add_style(game.LvglButton6.self, lvgl.BTN_PART_MAIN, Style_LvglButton6_1)
	--This is to add callback function for game.LvglButton6
	--This is callBack function of game.LvglButton6
	local handleLvglButton6 = function(obj, e)
		game.LvglButton6.cb(e)
		game.LvglButton6.cb = function(e)
			if (e == lvgl.EVENT_CLICKED)then
				dir_down()
			end
		end
	end
	lvgl.obj_set_event_cb(game.LvglButton6.self, handleLvglButton6)


	--This is the LABEL_PART_MAIN's style of game.LvglLabel2
	Style_LvglLabel2_1=lvgl.style_t()
	lvgl.style_init(Style_LvglLabel2_1)

	--This is the base code of game.LvglLabel2
	game.LvglLabel2.self = lvgl.label_create(game.contFather_game, nil)
	lvgl.obj_set_width(game.LvglLabel2.self, 180)
	lvgl.obj_set_click(game.LvglLabel2.self, true)
	lvgl.label_set_long_mode(game.LvglLabel2.self, lvgl.LABEL_LONG_EXPAND)
	lvgl.label_set_align(game.LvglLabel2.self, lvgl.LABEL_ALIGN_LEFT)
	lvgl.label_set_text(game.LvglLabel2.self, "分数：")
	lvgl.obj_align(game.LvglLabel2.self, game.contFather_game, lvgl.ALIGN_IN_TOP_LEFT, 329, 637)
	lvgl.obj_add_style(game.LvglLabel2.self, lvgl.LABEL_PART_MAIN, Style_LvglLabel2_1)


	--This is the IMG_PART_MAIN's style of game.LvglImghead
	Style_LvglImghead_1=lvgl.style_t()
	lvgl.style_init(Style_LvglImghead_1)

	--This is the base code of game.LvglImghead
	game.LvglImghead.self = lvgl.img_create(game.contFather_game, nil)
	lvgl.obj_set_click(game.LvglImghead.self, true)
	lvgl.img_set_src(game.LvglImghead.self, "/lua/beanU.jpg")
	lvgl.obj_align(game.LvglImghead.self, game.contFather_game, lvgl.ALIGN_IN_TOP_LEFT, 187, 364)
	lvgl.obj_add_style(game.LvglImghead.self, lvgl.IMG_PART_MAIN, Style_LvglImghead_1)


	--This is the IMG_PART_MAIN's style of game.LvglImgmnck
	Style_LvglImgmnck_1=lvgl.style_t()
	lvgl.style_init(Style_LvglImgmnck_1)

	--This is the base code of game.LvglImgmnck
	game.LvglImgmnck.self = lvgl.img_create(game.contFather_game, nil)
	lvgl.obj_set_click(game.LvglImgmnck.self, true)
	lvgl.img_set_src(game.LvglImgmnck.self, "/lua/mooncake.png")
	lvgl.obj_align(game.LvglImgmnck.self, game.contFather_game, lvgl.ALIGN_IN_TOP_LEFT, 10, 10)
	lvgl.obj_add_style(game.LvglImgmnck.self, lvgl.IMG_PART_MAIN, Style_LvglImgmnck_1)


	--This is the LABEL_PART_MAIN's style of game.LvglLabelscore
	Style_LvglLabelscore_1=lvgl.style_t()
	lvgl.style_init(Style_LvglLabelscore_1)

	--This is the base code of game.LvglLabelscore
	game.LvglLabelscore.self = lvgl.label_create(game.contFather_game, nil)
	lvgl.obj_set_click(game.LvglLabelscore.self, true)
	lvgl.label_set_long_mode(game.LvglLabelscore.self, lvgl.LABEL_LONG_EXPAND)
	lvgl.label_set_align(game.LvglLabelscore.self, lvgl.LABEL_ALIGN_LEFT)
	lvgl.label_set_text(game.LvglLabelscore.self, "0")
	lvgl.obj_align(game.LvglLabelscore.self, game.contFather_game, lvgl.ALIGN_IN_TOP_LEFT, 382, 638)
	lvgl.obj_add_style(game.LvglLabelscore.self, lvgl.LABEL_PART_MAIN, Style_LvglLabelscore_1)
end
game.free = function()
	lvgl.obj_del(game.contFather_game)
	game.contFather_game = nil
end

----------------------------------------------------------------------------
--The following is the content of screen: gmover
---------------------------------------------------------------------------
gmover.create = function()
	gmover.contFather_gmover = lvgl.cont_create(lvgl.scr_act(), nil)
	lvgl.obj_set_size(gmover.contFather_gmover, 480, 854)
	lvgl.obj_align(gmover.contFather_gmover, nil, lvgl.ALIGN_IN_TOP_LEFT, 0, 0)

	--This is the IMG_PART_MAIN's style of gmover.LvglImg2
	Style_LvglImg2_1=lvgl.style_t()
	lvgl.style_init(Style_LvglImg2_1)

	--This is the base code of gmover.LvglImg2
	gmover.LvglImg2.self = lvgl.img_create(gmover.contFather_gmover, nil)
	lvgl.obj_set_click(gmover.LvglImg2.self, true)
	lvgl.img_set_src(gmover.LvglImg2.self, "/lua/bg.png")
	lvgl.obj_align(gmover.LvglImg2.self, gmover.contFather_gmover, lvgl.ALIGN_IN_TOP_LEFT, 0, 0)
	lvgl.obj_add_style(gmover.LvglImg2.self, lvgl.IMG_PART_MAIN, Style_LvglImg2_1)


	--This is the LABEL_PART_MAIN's style of gmover.LvglLabel1
	Style_LvglLabel1_1=lvgl.style_t()
	lvgl.style_init(Style_LvglLabel1_1)

	--This is the base code of gmover.LvglLabel1
	gmover.LvglLabel1.self = lvgl.label_create(gmover.contFather_gmover, nil)
	lvgl.obj_set_click(gmover.LvglLabel1.self, true)
	lvgl.label_set_long_mode(gmover.LvglLabel1.self, lvgl.LABEL_LONG_EXPAND)
	lvgl.label_set_align(gmover.LvglLabel1.self, lvgl.LABEL_ALIGN_LEFT)
	lvgl.label_set_text(gmover.LvglLabel1.self, "你死了")
	lvgl.obj_align(gmover.LvglLabel1.self, gmover.contFather_gmover, lvgl.ALIGN_IN_TOP_LEFT, 203, 153)
	lvgl.obj_add_style(gmover.LvglLabel1.self, lvgl.LABEL_PART_MAIN, Style_LvglLabel1_1)


	--This is the BTN_PART_MAIN's style of gmover.LvglButton1
	Style_LvglButton1_1=lvgl.style_t()
	lvgl.style_init(Style_LvglButton1_1)
	lvgl.style_set_radius(Style_LvglButton1_1, lvgl.STATE_DEFAULT, 85)
	lvgl.style_set_bg_color(Style_LvglButton1_1, lvgl.STATE_DEFAULT, lvgl.color_hex(0x0088FF))
	lvgl.style_set_text_color(Style_LvglButton1_1, lvgl.STATE_DEFAULT, lvgl.color_hex(0xFFFFFF))

	--This is the base code of gmover.LvglButton1
	gmover.LvglButton1.self = lvgl.btn_create(gmover.contFather_gmover, nil)
	lvgl.obj_set_size(gmover.LvglButton1.self, 150, 150)
	lvgl.obj_set_click(gmover.LvglButton1.self, true)
	--This is the virtual Label of LvglButton1
	vLabel_LvglButton1 = lvgl.label_create(gmover.LvglButton1.self, nil)
	lvgl.label_set_text(vLabel_LvglButton1, "再来一次")
	lvgl.obj_add_style(vLabel_LvglButton1, lvgl.LABEL_PART_MAIN, Style_LvglButton1_1)
	lvgl.obj_align(gmover.LvglButton1.self, gmover.contFather_gmover, lvgl.ALIGN_IN_TOP_LEFT, 166, 276)
	lvgl.obj_add_style(gmover.LvglButton1.self, lvgl.BTN_PART_MAIN, Style_LvglButton1_1)
	--This is to add callback function for gmover.LvglButton1
	--This is callBack function of gmover.LvglButton1
	local handleLvglButton1 = function(obj, e)
		gmover.LvglButton1.cb(e)
		gmover.LvglButton1.cb = function(e)
			if (e == lvgl.EVENT_CLICKED)then
				gameagain()
			end
		end
	end
	lvgl.obj_set_event_cb(gmover.LvglButton1.self, handleLvglButton1)
end
gmover.free = function()
	lvgl.obj_del(gmover.contFather_gmover)
	gmover.contFather_gmover = nil
end


----------------------------------------------------------------------------
-----------------------This is the Initial of lvglGUI-----------------------
----------------------------------------------------------------------------
function lvglUiInitial()
	P1.create()
end
